export type FizzBuzzType = number | string;

const MIN = 0
const MAX = 100
function fizzBuzzConverter(a: number) {
    if(a <= MIN || a > MAX) {
        // tslint:disable-next-line:new-parens
        throw new RangeError
    }
    if(a.toString().includes('3')) {
        return 'Fizz'// 数字包含3，打印Fizz
    }else if(a%3 === 0 && a%5 === 0 && a%7 === 0) {
        return 'FizzBuzzWhizz'
    }else if (a%3 === 0 && a%5 === 0) {
        return 'FizzBuzz'
    }else if(a%3 === 0 && a%7 === 0) {
        return 'FizzWhizz'
    }else if(a%5 === 0 && a%7 === 0) {
        return 'BuzzWhizz'
    }else if(a%3 === 0) {
        return 'Fizz'// 数字是3的倍数
    }else if(a%5 === 0) {
        return 'Buzz'// 数字是5的倍数
    }else if(a%7 === 0) {
        return 'Whizz'// 数字是7的倍数
    }else{
        return a.toString();
    }
}

export default fizzBuzzConverter;